﻿CREATE VIEW dbo.v_BuyersOrder#Update
WITH  VIEW_METADATA
AS
SELECT     dbo.t_LoanInfo.LoanID, dbo.t_CarInfo.LoanID AS CI_LoanID, dbo.t_LoanInfo.DownPayment, dbo.t_LoanInfo.LoanAmount, 
                      dbo.t_LoanInfo.NumberOfPayments AS LoanTerm, dbo.t_LoanInfo.NumberOfPayments, dbo.t_LoanInfo.APROverride, dbo.t_LoanInfo.DealerFee, 
                      dbo.t_LoanInfo.TaxableFees, dbo.t_LoanInfo.GAP, dbo.t_LoanInfo.ServiceContract, dbo.t_LoanInfo.TradeIn, dbo.t_LoanInfo.AdvancePercent, 
                      dbo.t_LoanInfo.AdvancePercentOverride, dbo.t_LoanInfo.ProcessingFee, dbo.t_LoanInfo.UnderwritingFee, dbo.t_LoanInfo.OriginationFee, 
                      dbo.t_LoanInfo.DocPrepFee, dbo.t_LoanInfo.TaxServiceFee, dbo.t_LoanInfo.PPP, dbo.t_LoanInfo.SalesTaxPercent, dbo.t_LoanInfo.SalesTaxAmount, 
                      dbo.t_LoanInfo.UnPaidBalanceWithTax, dbo.t_LoanInfo.TagFee, dbo.t_LoanInfo.TrackerFee, dbo.t_LoanInfo.ContractDate, 
                      dbo.t_LoanInfo.FirstPaymentDate, dbo.t_LoanInfo.Declined, dbo.t_LoanInfo.AddOnRateOverride, dbo.t_LoanInfo.PaymentOverride, 
                      dbo.t_LoanInfo.DiscountPercent, dbo.t_LoanInfo.OtherFees AS NonTaxableFees, dbo.t_LoanInfo.IsRule78, dbo.t_CarInfo.Price AS SalesPrice, 
                      dbo.t_Loan.ContractHolderID, dbo.t_Loan.ID AS Loan_ID, dbo.t_CarInfo.VIN, dbo.t_Loan.DealerSalesPersonID, dbo.t_LoanInfo.PaymentsPerYear, 
                      dbo.t_LoanInfo.PaymentTypeID, dbo.t_LoanInfo.PrincipalBalance, dbo.t_LoanInfo.DayCountConventionID, dbo.t_LoanInfo.InterestType, 
                      dbo.t_CarInfo.BookValueCurrent, dbo.t_CarInfo.BookValueCurrentTypeID, dbo.t_Car.VIN AS C_VIN, dbo.t_Car.Year AS CarYear, 
                      dbo.t_Loan.StatusID
FROM         dbo.t_LoanInfo INNER JOIN
                      dbo.t_CarInfo ON dbo.t_LoanInfo.LoanID = dbo.t_CarInfo.LoanID INNER JOIN
                      dbo.t_Loan ON dbo.t_LoanInfo.LoanID = dbo.t_Loan.ID AND dbo.t_CarInfo.LoanID = dbo.t_Loan.ID LEFT OUTER JOIN
                      dbo.t_Car ON dbo.t_CarInfo.VIN = dbo.t_Car.VIN

GO
EXECUTE sp_addextendedproperty @name = N'MS_DiagramPane1', @value = N'[0E232FF0-B466-11cf-A24F-00AA00A3EFFF, 1.00]
Begin DesignProperties = 
   Begin PaneConfigurations = 
      Begin PaneConfiguration = 0
         NumPanes = 4
         Configuration = "(H (1[31] 4[20] 3[25] 2) )"
      End
      Begin PaneConfiguration = 1
         NumPanes = 3
         Configuration = "(H (1 [50] 4 [25] 3))"
      End
      Begin PaneConfiguration = 2
         NumPanes = 3
         Configuration = "(H (1 [50] 2 [25] 3))"
      End
      Begin PaneConfiguration = 3
         NumPanes = 3
         Configuration = "(H (4 [30] 2 [40] 3))"
      End
      Begin PaneConfiguration = 4
         NumPanes = 2
         Configuration = "(H (1 [56] 3))"
      End
      Begin PaneConfiguration = 5
         NumPanes = 2
         Configuration = "(H (2 [66] 3))"
      End
      Begin PaneConfiguration = 6
         NumPanes = 2
         Configuration = "(H (4 [50] 3))"
      End
      Begin PaneConfiguration = 7
         NumPanes = 1
         Configuration = "(V (3))"
      End
      Begin PaneConfiguration = 8
         NumPanes = 3
         Configuration = "(H (1[56] 4[18] 2) )"
      End
      Begin PaneConfiguration = 9
         NumPanes = 2
         Configuration = "(H (1[75] 4) )"
      End
      Begin PaneConfiguration = 10
         NumPanes = 2
         Configuration = "(H (1[66] 2) )"
      End
      Begin PaneConfiguration = 11
         NumPanes = 2
         Configuration = "(H (4 [60] 2))"
      End
      Begin PaneConfiguration = 12
         NumPanes = 1
         Configuration = "(H (1) )"
      End
      Begin PaneConfiguration = 13
         NumPanes = 1
         Configuration = "(V (4))"
      End
      Begin PaneConfiguration = 14
         NumPanes = 1
         Configuration = "(V (2))"
      End
      ActivePaneConfig = 9
   End
   Begin DiagramPane = 
      Begin Origin = 
         Top = 0
         Left = 0
      End
      Begin Tables = 
         Begin Table = "t_LoanInfo"
            Begin Extent = 
               Top = 6
               Left = 38
               Bottom = 547
               Right = 239
            End
            DisplayFlags = 280
            TopColumn = 4
         End
         Begin Table = "t_CarInfo"
            Begin Extent = 
               Top = 74
               Left = 283
               Bottom = 342
               Right = 485
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "t_Loan"
            Begin Extent = 
               Top = 3
               Left = 530
               Bottom = 359
               Right = 710
            End
            DisplayFlags = 280
            TopColumn = 0
         End
         Begin Table = "t_Car"
            Begin Extent = 
               Top = 455
               Left = 523
               Bottom = 793
               Right = 726
            End
            DisplayFlags = 280
            TopColumn = 0
         End
      End
   End
   Begin SQLPane = 
      PaneHidden = 
   End
   Begin DataPane = 
      PaneHidden = 
      Begin ParameterDefaults = ""
      End
   End
   Begin CriteriaPane = 
      Begin ColumnWidths = 11
         Column = 1845
         Alias = 1395
         Table = 1170
         Output = 720
         Append = 1400
         NewValue = 1170
         SortType = 1350
         SortOrder = 1410
         GroupBy = 1350
         Filter = 1350
         Or = 1350
         Or = 1350
         Or = 1350
      End
   End
End', @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_BuyersOrder#Update';


GO
EXECUTE sp_addextendedproperty @name = N'MS_DiagramPaneCount', @value = 1, @level0type = N'SCHEMA', @level0name = N'dbo', @level1type = N'VIEW', @level1name = N'v_BuyersOrder#Update';

